home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / limits.h < prev    next >
C/C++ Source or Header  |  1992-12-29  |  3KB  |  110 lines

  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /*
  20.  *    ANSI Standard: 4.14/2.2.4.2 Limits of integral types    <limits.h>
  21.  */
  22.  
  23. #ifndef    _LIMITS_H
  24.  
  25. #define    _LIMITS_H    1
  26. #include <features.h>
  27.  
  28. #ifdef    __USE_POSIX
  29. /* POSIX adds things to <limits.h>.  */
  30. #include <posix1_lim.h>
  31. #endif
  32.  
  33. #ifdef    __USE_POSIX2
  34. #include <posix2_lim.h>
  35. #endif
  36.  
  37.  
  38. #if    __GNUC__ >= 2
  39.  
  40.  /* Get the compiler's limits.h, which defines all the ANSI constants.  */
  41.  #define _LIBC_LIMITS_H_    /* This tells it not to look for another.  */
  42.  #ifndef _GCC_LIMITS_H_        /* This is what GCC's file defines.  */
  43.  #include_next <limits.h>
  44.  #endif
  45.  
  46. #else    /* Not GCC 2.  */
  47.  
  48. /* We don't have #include_next.
  49.    Define ANSI <limits.h> for standard 32-bit words.  */
  50.  
  51. /* These assume 8-bit `char's, 16-bit `short int's,
  52.    and 32-bit `int's and `long int's.  */
  53.  
  54. /* Number of bits in a `char'.    */
  55. #define    CHAR_BIT    8
  56.  
  57. /* Maximum length of any multibyte character in any locale.
  58.    Locale-writers should change this as necessary.  */
  59. #define    MB_LEN_MAX    1
  60.  
  61. /* Minimum and maximum values a `signed char' can hold.  */
  62. #define    SCHAR_MIN    (-128)
  63. #define    SCHAR_MAX    127
  64.  
  65. /* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
  66. #ifdef    __STDC__
  67. #define    UCHAR_MAX    255U
  68. #else
  69. #define    UCHAR_MAX    255
  70. #endif
  71.  
  72. /* Minimum and maximum values a `char' can hold.  */
  73. #ifdef __CHAR_UNSIGNED__
  74. #define    CHAR_MIN    0
  75. #define    CHAR_MAX    UCHAR_MAX
  76. #else
  77. #define    CHAR_MIN    SCHAR_MIN
  78. #define    CHAR_MAX    SCHAR_MAX
  79. #endif
  80.  
  81. /* Minimum and maximum values a `signed short int' can hold.  */
  82. #define    SHRT_MIN    (-32768)
  83. #define    SHRT_MAX    32767
  84.  
  85. /* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
  86. #define    USHRT_MAX    65535
  87.  
  88. /* Minimum and maximum values a `signed int' can hold.  */
  89. #define    INT_MIN    (- INT_MAX - 1)
  90. #define    INT_MAX    2147483647
  91.  
  92. /* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
  93. #ifdef    __STDC__
  94. #define    UINT_MAX    4294967295U
  95. #else
  96. #define    UINT_MAX    4294967295
  97. #endif
  98.  
  99. /* Minimum and maximum values a `signed long int' can hold.  */
  100. #define    LONG_MIN    INT_MIN
  101. #define    LONG_MAX    INT_MAX
  102.  
  103. /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
  104. #define    ULONG_MAX    UINT_MAX
  105.  
  106. #endif    /* GCC 2.  */
  107.  
  108.  
  109. #endif    /* limits.h  */
  110.